#pragma once

#include "BaseWindow.h"
#include "mtxlib.h"
//#include "Quaternion.h"
//#include "Puma6C.h"
#include "PumaQuat.h"
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>

class MainWindow : public BaseWindow
{
private:
	GLint		viewport[4];
	GLdouble	modelview[16];
	GLdouble	projection[16];
	matrix44	lewy, prawy, perspL, perspR;
	matrix44	View, Tb, *T;
	Puma6C		puma;
	PumaPack	pack[8], beg, end, packL, packR;
	matrix44	Tbeg, Tend, Tcur;
	PumaQuat	quatPuma;
	int			packind;
	bool		timerOn;

	GLUquadric * pumaMesh;
	GLUquadric * axisMesh;

	float		t_inter;
	float		krok;
protected:

	void	reinitWndScreenData();
	void	DrawPuma(PumaPack& packet);
	void	DrawScene(float* perspMatrix, PumaPack& packet);
	void	DrawAxis();
	void	InitLight();
	void	StartTimer();
	void	StopTimer();
public:
	MainWindow(HINSTANCE hInastance);

	void	InitGL();
	void	Draw();
	void	SizeChanged();
	void	OnInit();
	void	OnCreate();
	void	OnDestroy();
	void	OnMenuChoosed(WPARAM wParam);
	void	OnLButtonDown(WPARAM wParam, LPARAM lParam);
	void	OnRButtonDown(WPARAM wParam, LPARAM lParam);
	void	OnMouseMove(WPARAM wParam, LPARAM lParam);
	void	OnMouseWheel(WPARAM wParam, LPARAM lParam);
	void	OnKeyDown(WPARAM wParam);
	void	OnTimerMethod();
};